﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace XCI.Sys.Helper
{
    public static class SysHelper
    {
        ///// <summary>
        ///// 设置对象的操作用户信息(包括OperateDateTime/OperateUserId/OperateUserName/DepartmentId/DepartmentName)
        ///// </summary>
        ///// <param name="entity">待操作的对象</param>
        //public static void BindOperateUserInfo(object entity)
        //{
        //    AppUser user = AppData.CurrentUser;
        //    var type = entity?.GetType();

        //    type?.GetProperty("OperateDateTime")?.SetValue(entity, DateTime.Now, null);
        //    type?.GetProperty("OperateUserId")?.SetValue(entity, user.UserId, null);
        //    type?.GetProperty("OperateUserName")?.SetValue(entity, user.UserName, null);

        //    type?.GetProperty("CreateDateTime")?.SetValue(entity, DateTime.Now, null);
        //    type?.GetProperty("CreateUserId")?.SetValue(entity, user.UserId, null);
        //    type?.GetProperty("CreateUserName")?.SetValue(entity, user.UserName, null);

        //    type?.GetProperty("UpdateDateTime")?.SetValue(entity, DateTime.Now, null);
        //    type?.GetProperty("UpdateUserId")?.SetValue(entity, user.UserId, null);
        //    type?.GetProperty("UpdateUserName")?.SetValue(entity, user.UserName, null);

        //    type?.GetProperty("OperateDepartmentId")?.SetValue(entity, user.DeptId, null);
        //    type?.GetProperty("OperateDepartmentName")?.SetValue(entity, user.DeptName, null);
        //}
    }
}
